//
//  GeneralHelper.h
//
//  Created by ZhàoYǒng on 23/10/2017.
//  Copyright © 2017 ZhàoYǒng. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, FileType) {
    FileTypeUnknown = 0,
    FileTypePhoto,
    FileTypeVideo,
    FileTypeAudio,
    FileTypePsd,
    FileTypePdf,
    FileTypePPT,
    FileTypeWord,
    FileTypeXls,
    FileTypeXml,
    FileTypeExe,
    FileTypeHtml,
    FileTypeRTF,
    FileTypeTxt,
    FileTypeZip,
};

@interface GeneralHelper : NSObject

// GCD
void AfterDispatch(double delayInSeconds, dispatch_block_t _Nullable block);
void MainDispatch(dispatch_block_t _Nullable block);
void GlobalDispatch(dispatch_block_t _Nullable block);

// Key chain
NSString * _Nonnull KeychainService(void);
void KeychainSave(NSString * _Nullable service, id _Nullable data);
id _Nullable KeychainLoad(NSString * _Nullable service);
void KeychainDelete(NSString * _Nullable service);
NSString * _Nullable KeychainUDID(void);

// 语言
NSString * _Nullable CurrentLanguage(void); // 当前语言代码
NSString * _Nullable CurInputMode(void);
NSString * _Nullable CurrentLanguageString(void); // 当前语言描述

// 系统
unsigned long long TotalDiskSize(void); // 获取磁盘总容量
unsigned long long AvailableDiskSize(void); // 获取磁盘剩余容量
NSString * _Nullable FileSizeToString(unsigned long long fileSize); // 容量转换
NSString * _Nullable DeviceName(void); // 获取本机名称
NSString * _Nullable DevicePlatform(void); // 获取本机型号

// 应用
NSString * _Nullable ApplicationName(void);
NSString * _Nullable ApplicationVersion(void); // 获取应用版本号
NSString * _Nullable ApplicationBuild(void); // 获取应用构建号
NSString * _Nullable ApplicationBundleId(void);
void IsAllowedNotification(void(^ _Nullable completionBlock)(BOOL isAllowed)); //用户是否允许推送

// 格式
NSString * _Nullable HtmlTrimming(NSString * _Nullable htmlString); // 正则去除网络标签
NSArray * _Nullable HtmlScreenOutImage(NSString * _Nullable htmlString); // 获取img
// MOV格式转MP4格式
typedef void (^TansformVedioCompleted)(NSString * _Nullable Mp4FilePath);
typedef void (^TansformVedioFail)(void);
void TransformMOVToMP4(NSURL * _Nullable movUrl,
                       TansformVedioCompleted _Nullable completionBlock,
                       TansformVedioFail _Nullable failureBlock);
void PlayEffectSound(NSString * _Nullable sound, NSString * _Nullable type); // 播放音效
FileType GetFileType(NSString * _Nullable pathEx);

@end
